﻿using HRMsystemShi._2025;
using HRMSystemShi.Model;

namespace HRMSystemShi._2025
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();
        }

        private void FormMain_Load(object sender, EventArgs e)
        {
            this.IsMdiContainer = true;
            FormLogin formLogin = new FormLogin();
            DialogResult result = formLogin.ShowDialog();
            if (result != DialogResult.OK)
            {
                Application.Exit();
            }
            labelUserInfomation.Text = CommonHelper.MessageUserInfomation();
            tsmiAdmin.Visible = LoginUserInfo.GetInstance().IsAdmin ? true : false;
        }

        private void tsmiFixPassword_Click(object sender, EventArgs e)
        {
            FormFixPassword formFixPassword = new FormFixPassword();
            formFixPassword.MdiParent = this;
            formFixPassword.Show();
        }

        private void tsmiLogManager_Click(object sender, EventArgs e)
        {
            FormOperationLog formOperationLog = new FormOperationLog();
            formOperationLog.MdiParent = this;
            formOperationLog.Show();
        }

        private void tsmiEmployeeList_Click(object sender, EventArgs e)
        {
            FormEmployee formEmployee = new FormEmployee();
            formEmployee.MdiParent = this;
            formEmployee.Show();
        }

        private void tsmiOperatorManager_Click(object sender, EventArgs e)
        {
            FormOperator formOperator = new FormOperator();
            formOperator.MdiParent = this;
            formOperator.Show();
        }

        private void tsmiCreateSalarySheet_Click(object sender, EventArgs e)
        {
            FormCreateSalarySheet formCreateSalarySheet = new FormCreateSalarySheet();
            formCreateSalarySheet.MdiParent = this;
            formCreateSalarySheet.Show();
        }

        private void tsmiSalaryReportPrint_Click(object sender, EventArgs e)
        {
            FormSalarySheetReport report = new FormSalarySheetReport();
            report.MdiParent = this;
            report.Show();
        }

        private void tsmiCheckSalarySheet_Click(object sender, EventArgs e)
        {
            FormCheckSalarySheet formCheckSalarySheet = new FormCheckSalarySheet();
            formCheckSalarySheet.MdiParent = this;
            formCheckSalarySheet.Show();
        }

        private void stmiDepartmentManager_Click(object sender, EventArgs e)
        {
            FormDepart formDepart = new FormDepart();
            formDepart.MdiParent = this;
            formDepart.Show();
        }

        private void tsmiExit_Click(object sender, EventArgs e)
        {
            if(CommonHelper.MessageYesOrNo("确定退出吗?") == DialogResult.Yes)
            {
                Application.Exit();
            }
        }
    }
}
